package com.ingesup.ws.services;

import javax.jws.WebParam;
import javax.jws.WebService;

import com.ingesup.ws.models.User;
import com.ingesup.ws.models.UserType;
//import static com.ingesup.ws.services.Datas.*;

@WebService
public class UserManagement {

	/*public boolean addUser(User user) {
		//users.put(getUserId(), user);
		return User.create(user);	
	}*/
	
	public boolean addUser(String email,String password,String firstName,String lastName,String phone,String address,UserType type) {
		//users.put(getUserId(), user);
		return User.create(email, password, firstName, lastName, phone, address, type);		
	}

	/*public boolean modUser(Long id, User user) {
		//users.put(id, user);
		return User.edit(id, user.getEmail(), user.getPassword(), user.getFirstName(), user.getLastName(), user.getPhone(), user.getAddress());
	}*/
	
	public boolean modUser(long id,String email,String password,String firstName,String lastName,String phone,String address,UserType type) {
		//users.put(id, user);
		return User.edit(id, email, password, firstName, lastName, phone, address, type);
	}

	public User getUser(Long id) {
		//return users.get(id);
		try {
			return User.find(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
	
	public int connection(String email,String password){
		return User.connect(email, password);
	}

}
